<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<script>
  window.onload = function () {
    let bnt1 = document.querySelectorAll("#btn1")[0]
    let bnt2 = document.querySelectorAll("#btn2")[0]
    let bnt3 = document.querySelectorAll("#btn3")[0]
    
    bnt1.onclick = function () {
      alert("内容")
    }
    bnt2.onclick = function () {
      console.log(confirm("内容"));
    }
    bnt3.onclick = function () {
      console.log(prompt("内容"));
      
    }

  }

</script>

<body>
  <input id="btn1" type="button" value="警告框">
  <input id="btn2" type="button" value="选择框">
  <input id="btn3" type="button" value="输入框">
</body>

</html>